<script setup lang="ts">
import Header from "../components/Header.vue";
import Sidebar from "../components/Sidebar.vue";
</script>

<template>
  <div class="common-layout">
    <el-container class="layout-container">
      <el-header class="layout-header"><Header /></el-header>
      <el-container class="layout-body">
        <el-aside width="200px" class="layout-aside"><Sidebar /></el-aside>
        <el-main class="layout-main">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style scoped>
.common-layout {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.layout-container {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.layout-header {
  background-color: #ffffff;
  border-bottom: 1px solid #e6e6e6;
  padding: 0;
  display: flex;
  align-items: center;
  height: 60px;
  flex-shrink: 0;
}

.layout-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.layout-aside {
  background-color: #f0f9eb;
  border-right: 1px solid #e6e6e6;
  overflow-y: auto;
  width: 200px;
  flex-shrink: 0;
}

.layout-main {
  flex: 1;
  padding: 20px;
  background-color: #f5f7fa;
  overflow-y: auto;
  min-height: 0; /* 修复flex布局中的溢出问题 */
}
</style>